import React, { FC,useState,useEffect } from 'react'
import { Space,Typography } from 'antd'
import { FormOutlined } from '@ant-design/icons'
import  './Logo.css'
import useGetUserInfo from '../hooks/useGetUserInfo.ts'
import { Link } from 'react-router-dom'
const { Title } = Typography
const Logo: FC = ()=>{
    const { username } = useGetUserInfo()
    const [ pathname, setPathname ] = useState('/')

    useEffect(()=>{
        if(username){
            setPathname('/manage/list')
        }
    },[username])

    return <div className="leftC">
        <Link to={pathname}>
            <Space>
                <Title>
                    <FormOutlined />
                </Title>
                <Title>
                    小董问卷
                </Title>
            </Space>
        </Link>
    </div>
}

export default Logo